<template>
    <view class="cart" @click.stop="toCart">
        <view class="content">
            <text class="num" v-show="parseNum > 0">{{ parseNum }}</text>
        </view>
        <view class="submit" v-show="parseNum > 0">
            <text>下单</text>
        </view>
    </view>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
    components: {},
    props: {
    },
    data() {
        return {}
    },
    computed: {
        ...mapGetters([
            'parseNum',
        ])
    },
    watch: {},
    created() { },
    methods: {
        toCart() {
            uni.navigateTo({ url: '/pages/cart/cart' })
        }
    },
    mounted() { },
    beforeCreate() { },
    beforeMount() { },
    beforeUpdate() { },
    updated() { },
    beforeDestroy() { },
    destroyed() { },
    activated() { },
    deactivated() { },
}
</script>
<style lang='scss' scoped>
.cart {
    position: fixed;
    bottom: calc(var(--window-bottom) + 50rpx);
    right: 50rpx;

    width: 100rpx;
    height: 100rpx;

    border-radius: 50rpx;
    background-color: #ffffff;
    box-shadow: 0 0 10rpx 2rpx rgba(#ff0000, 0.1);

    display: flex;
    justify-content: center;
    align-items: center;


    .content {
        background-color: #ffffff;
        width: 100rpx;
        height: 100rpx;
        border-radius: 50rpx;
        background-image: url("@/static/cart.png");
        background-repeat: no-repeat;
        background-position: 18rpx 15rpx;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 3;
    }

    .num {
        background-color: #ff0000;
        padding: 2rpx 10rpx;
        border-radius: 20rpx;
        color: #ffffff;
        position: absolute;
        top: 0;
        left: 90rpx;
        font-size: 18rpx;
    }

    .submit {
        width: 250rpx;
        height: 100rpx;

        background-color: #ffffff;
        position: absolute;
        right: 50rpx;
        top: 0;

        border-top-left-radius: 50rpx;
        border-bottom-left-radius: 50rpx;
        box-shadow: 0 0 10rpx 2rpx rgba(#ff0000, 0.1);

        z-index: 2;

        display: flex;
        justify-content: center;
        align-items: center;

        text {
            font-size: 36rpx;
            font-weight: 800;
            color: #ff0000;
            font-style: italic;
        }
    }
}
</style>